﻿@{
    var list = ViewData["List"] as List<MenuListModel> ?? new List<MenuListModel>(0);
}

@*如果某个项目被选中则需要添加 class="jstree-wholerow jstree-wholerow-clicked"*@

@if (list.Count > 0)
{
    <ul>
        @foreach (var item in list)
        {
            @*data-menuid 这个添加选中的class*@
            <li data-jstree='{"opened":true,"icon":"fa fa-sitemap"}' data-menuid="@(string.IsNullOrEmpty(item.Value)?"0":item.Value)">
                <a href="@Url.Action("List", null, new { parentId = item.Value, name =item.Text }, "http")">@item.Text</a>
                @if (item.Childs != null && item.Childs.Count > 0)
                {
                    @Html.Partial("_LeftMenuChild", new ViewDataDictionary { { "List", item.Childs } })
                }
            </li>
        }
    </ul>
}
else
{
    <strong>没有菜单</strong>
}
